package lab02.test31;

import java.util.ArrayList;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        String[] numbers = new String[5];
        //List,Map,Set
        List<Integer> alist = new ArrayList<Integer>();
        //Integer:包装类型，int

        alist.add(1);
        alist.add(2);
        alist.add(3);


        List<Integer> numberList = new ArrayList<Integer>();
        numberList.add(10);
        numberList.add(42);
        numberList.add(85);
        numberList.add(23);
        numberList.add(35);
        numberList.add(52);

        numberList.addAll(alist);
        //遍历集合
        for (Integer n : numberList) {
            System.out.println(n);
        }


        List<String> names = new ArrayList<String>();
        names.add("张三");
        names.add("李四");
        names.add("王五");
        names.add("马六");
        names.add("赵七");

        for(String str:names){
            System.out.print(names.indexOf(str));
            System.out.println(str);
        }

        System.out.println("集合大小"+names.size());
        names.remove(2);

        System.out.println("第三个元素："+names.get(2));
    }
}